* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --neon-purple: #FF00FF; /* Fuchsia */
    --neon-purple-rgb: 255, 0, 255;
    --neon-pink: #FF69B4; /* Hot Pink */
    --neon-pink-rgb: 255, 105, 180;
    --neon-accent: #DA70D6; /* Orchid */
    --neon-accent-rgb: 218, 112, 214;
}

body {
    font-family: 'Cal Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    display: flex;
    flex-direction: column; /* Changed to column to stack elements */
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: radial-gradient(ellipse at center, #0a0a0a 0%, #000000 100%);
    margin: 0;
    color: var(--neon-accent); /* Adjusted base color */
    position: relative;
    overflow-x: hidden; /* Prevent horizontal scroll */
    padding: 20px 0; /* Add some vertical padding */
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

@keyframes neonFloat {
    0% { transform: translateY(0px) rotate(0deg); }
    100% { transform: translateY(-20px) rotate(2deg); }
}

.calculator-container {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px); /* Reduced blur for performance */
    padding: 40px;
    border-radius: 20px;
    border: 2px solid var(--neon-purple);
    text-align: center;
    width: 90%;
    max-width: 480px;
    position: relative;
    z-index: 1;
    animation: slideUp 0.8s ease-out;
    will-change: transform; /* Hint for browser optimization */
    box-shadow: 0 0 10px rgba(var(--neon-purple-rgb), 0.5), 0 0 20px rgba(var(--neon-pink-rgb), 0.3); /* Subtle glow added */
    margin-bottom: 40px; /* Space between calculator and spectrogram */
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes neonPulse {
    0%, 100% {
        box-shadow:
            0 0 12px rgba(var(--neon-purple-rgb), 0.5),
            0 0 20px rgba(var(--neon-purple-rgb), 0.3),
            inset 0 0 10px rgba(var(--neon-purple-rgb), 0.15);
    }
    50% {
        box-shadow:
            0 0 20px rgba(var(--neon-purple-rgb), 0.7),
            0 0 40px rgba(var(--neon-purple-rgb), 0.5),
            inset 0 0 20px rgba(var(--neon-purple-rgb), 0.25);
    }
}

h1 {
    color: #ffffff;
    margin-bottom: 20px;
    font-size: 2.2em;
    font-weight: 600;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.7), 0 0 15px rgba(var(--neon-pink-rgb), 0.5); /* Subtle glow added */
}

@keyframes neonTextGlow {
    0% {
        text-shadow:
            0 0 6px rgba(255, 255, 255, 0.7),
            0 0 12px rgba(var(--neon-pink-rgb), 0.5),
            0 0 20px rgba(var(--neon-purple-rgb), 0.3);
    }
    100% {
        text-shadow:
            0 0 12px rgba(255, 255, 255, 0.9),
            0 0 20px rgba(var(--neon-pink-rgb), 0.7),
            0 0 30px rgba(var(--neon-purple-rgb), 0.5);
    }
}

p {
    font-size: 1.1em;
    line-height: 1.6;
    color: #cccccc;
    margin-bottom: 30px;
}

.input-group {
    margin: 30px 0;
    text-align: left;
}

label {
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
    color: var(--neon-pink); /* Adjusted color */
    font-size: 1.1em;
}

input[type="number"] {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid var(--neon-pink);
    border-radius: 12px;
    font-size: 1.2em;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px); /* Reduced blur for performance */
    color: #ffffff;
    transition: all 0.3s ease;
}

input[type="number"]::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

input[type="number"]:focus {
    border-color: var(--neon-purple);
    outline: none;
    transform: translateY(-2px);
    color: var(--neon-purple);
}

button {
    background: linear-gradient(135deg, var(--neon-purple) 0%, var(--neon-pink) 100%); /* Adjusted colors */
    color: #000000;
    padding: 16px 32px;
    border: none;
    border-radius: 12px;
    font-size: 1.2em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 15px;
    position: relative;
    overflow: hidden;
    margin-bottom: 10px; /* Space for the new button */
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s ease;
    will-change: left; /* Hint for browser optimization */
}

button:hover {
    transform: translateY(-3px);
    background: linear-gradient(135deg, var(--neon-purple) 0%, var(--neon-accent) 50%, var(--neon-pink) 100%); /* Adjusted colors */
}

button:active {
    transform: translateY(-1px);
}

.secondary-button { /* Style for the new button */
    background: rgba(var(--neon-purple-rgb), 0.2);
    border: 2px solid var(--neon-pink);
    color: var(--neon-pink);
    margin-top: 10px; /* Space between buttons */
    padding: 14px 28px;
    font-size: 1.1em;
    font-weight: 500;
}

.secondary-button:hover {
    background: rgba(var(--neon-pink-rgb), 0.3);
    border-color: var(--neon-purple);
    color: var(--neon-purple);
    transform: translateY(-2px);
}

.secondary-button::before {
    display: none; /* Remove shimmer effect for secondary button */
}

.results {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid rgba(var(--neon-purple-rgb), 0.5); /* Adjusted color */
    animation: fadeIn 0.5s ease-out 0.3s both;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.results h2 {
    color: var(--neon-pink); /* New color */
    margin-bottom: 20px;
    font-size: 1.8em;
    font-weight: 600;
    text-shadow: 0 0 8px rgba(var(--neon-pink-rgb), 0.7), 0 0 15px rgba(var(--neon-accent-rgb), 0.5); /* Subtle glow added */
}

@keyframes neonResultsGlow {
    0% {
        text-shadow:
            0 0 6px rgba(var(--neon-pink-rgb), 0.7),
            0 0 12px rgba(var(--neon-pink-rgb), 0.5),
            0 0 20px rgba(var(--neon-accent-rgb), 0.3);
    }
    100% {
        text-shadow:
            0 0 12px rgba(var(--neon-pink-rgb), 0.9),
            0 0 20px rgba(var(--neon-pink-rgb), 0.7),
            0 0 30px rgba(var(--neon-accent-rgb), 0.5);
    }
}

.results p {
    font-size: 1.3em;
    margin-bottom: 15px;
    color: #cccccc;
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 10px;
    backdrop-filter: blur(2px); /* Reduced blur for performance */
    border: 1px solid rgba(var(--neon-purple-rgb), 0.3); /* Adjusted color */
    transition: all 0.3s ease;
}

.results p:hover {
    transform: translateX(5px);
    background: rgba(0, 0, 0, 0.8);
    border-color: rgba(var(--neon-pink-rgb), 0.5); /* Adjusted color */
}

.results span {
    font-weight: 600;
    color: var(--neon-purple); /* Adjusted color */
    text-shadow: 0 0 6px rgba(var(--neon-purple-rgb), 0.7), 0 0 10px rgba(var(--neon-accent-rgb), 0.5); /* Subtle glow added */
}

/* Modal Styles */
.modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease-out;
}

.modal-hidden {
    opacity: 0;
    pointer-events: none; /* Make it unclickable when hidden */
}

.modal-content {
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    padding: 40px;
    border-radius: 20px;
    border: 2px solid var(--neon-accent);
    width: 90%;
    max-width: 600px;
    text-align: left;
    color: #ffffff;
    box-shadow: 0 0 25px rgba(var(--neon-accent-rgb), 0.7);
    transform: translateY(0);
    transition: transform 0.3s ease-out;
}

.modal-hidden .modal-content {
    transform: translateY(-20px);
}

.modal-content h2 {
    color: var(--neon-pink);
    margin-bottom: 25px;
    font-size: 2em;
    text-align: center;
    text-shadow: 0 0 10px rgba(var(--neon-pink-rgb), 0.7);
}

.modal-content p {
    color: #e0e0e0;
    margin-bottom: 15px;
    font-size: 1.1em;
    line-height: 1.7;
    text-align: left; /* Ensure paragraphs are left-aligned in modal */
}

.modal-content ul {
    list-style: none;
    margin-left: 20px;
    margin-bottom: 20px;
}

.modal-content ul li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 8px;
    color: var(--neon-accent);
}

.modal-content ul li::before {
    content: '⭐'; /* Neon star bullet */
    position: absolute;
    left: 0;
    color: var(--neon-purple);
    font-size: 0.8em;
    line-height: 1.5;
}

.modal-close-button {
    background: linear-gradient(135deg, var(--neon-purple) 0%, var(--neon-pink) 100%);
    color: #000000;
    padding: 14px 28px;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
    width: fit-content;
    margin: 30px auto 0; /* Center the button */
}

.modal-close-button:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, var(--neon-purple) 0%, var(--neon-accent) 50%, var(--neon-pink) 100%);
}

.modal-close-button::before {
    display: none; /* No shimmer for modal close button */
}

/* Spectrogram Styles */
.spectrogram-container {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    padding: 20px; /* Keep padding to act as a frame for the canvas */
    border-radius: 20px;
    border: 2px solid var(--neon-pink);
    text-align: center;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 0 10px rgba(var(--neon-pink-rgb), 0.5), 0 0 20px rgba(var(--neon-purple-rgb), 0.3);
    margin-top: 20px;
    margin-bottom: 20px; /* Ensure space at the bottom */
}

#spectrogramCanvas {
    width: 100%;
    height: 200px; /* Fixed height for the spectrogram */
    background-color: transparent; /* Changed to transparent to let container background show */
    border: none; /* Removed border, container border is enough */
    border-radius: 10px; /* Kept border-radius for softer corners */
    margin-bottom: 0; /* Removed margin-bottom because button is gone */
}

@media (max-width: 480px) {
    .calculator-container {
        padding: 25px;
        margin: 20px;
        margin-bottom: 30px;
    }

    h1 {
        font-size: 1.8em;
    }

    input[type="number"] {
        padding: 14px 16px;
        font-size: 1.1em;
    }

    button {
        padding: 14px 28px;
        font-size: 1.1em;
    }

    .results p {
        font-size: 1.1em;
    }

    .modal-content {
        padding: 25px;
    }
    .modal-content h2 {
        font-size: 1.5em;
    }
    .modal-content p {
        font-size: 0.95em;
    }
    .modal-close-button {
        padding: 12px 24px;
        font-size: 1em;
    }

    .spectrogram-container {
        padding: 15px;
        margin-top: 15px;
        margin-left: 20px;
        margin-right: 20px;
    }

    #spectrogramCanvas {
        height: 150px;
    }
}